home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks96 / RoasterJavaWAHTTPCGI.sit / Roaster-Java-WA-HTTP-CGI hack / JavaWebStuff / JavaWebStuff.c < prev    next >
C/C++ Source or Header  |  1996-06-22  |  1KB  |  68 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <sioux.h>
  4.  
  5. #include "JavaRuntime.h"
  6. #include "Messages.h"
  7.  
  8. long gRunning = 0;
  9.  
  10. void main()
  11. {
  12.     OSErr status;
  13.     
  14.     char *foo;
  15.     
  16.     JavaRuntime rt;
  17.     JavaEnv        env;
  18.     
  19.     JavaRef        argvRef;
  20.     
  21.     EventRecord theEvent;
  22.     
  23.     char *argv = "80";
  24.     
  25.     SIOUXSettings.standalone = FALSE;
  26.     SIOUXSettings.setupmenus = TRUE;
  27.     
  28.     printf("Java Web Server Starting...\n");
  29.     
  30.     status = SetupQueues();
  31.     if (status != noErr)
  32.     {
  33.         printf("Error setting up queues -- %d\n", status);
  34.         return;
  35.     }
  36.     
  37.     FlushQ(SERVERQ);
  38.     FlushQ(CGIQ);
  39.     
  40.     rt = GetJavaRuntime();
  41.     
  42.     gRunning = 1;
  43.     
  44.     env = JavaEnv_make(rt, NULL);
  45.     if (env == NULL)
  46.     {
  47.         gRunning = 0;
  48.         printf("Can't make a java env!\n");
  49.     }
  50.     
  51.     //status = JavaArray_makeUTF(env, &argvRef, "[Ljava/lang/String;", 0);
  52.     
  53.     JavaObject_forkUTF(env, NULL, "wa/http/TinyHTTPd", 1, &argv);
  54.     /*
  55.     status = JavaObject_callStaticUTF(env, NULL, "wa/http/TinyHTTPd", "main", 
  56.                 "([Ljava/lang/String;)V", argvRef);
  57.     */
  58.     printf("Startup message %d\n", status);
  59.  
  60.     while (gRunning)
  61.     {
  62.         JavaRuntime_yield(10);
  63.         if ( WaitNextEvent(everyEvent, &theEvent, 1, NULL))
  64.             SIOUXHandleOneEvent(&theEvent);
  65.     }
  66.     
  67.     DisposeJavaRuntime();
  68. }